<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>学生登录</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" href="../qlx/vendor/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" href="../qlx/vendor/font-awesome/css/font-awesome.min.css">
    <!-- Fontastic Custom icon font-->
    <link rel="stylesheet" href="../qlx/css/fontastic.css">
    <!-- Google fonts - Poppins -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,700">
    <!-- theme stylesheet-->
    <link rel="stylesheet" href="../qlx/css/style.default.css" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" href="../qlx/css/custom.css">
    <!-- Favicon-->
    <link rel="shortcut icon" href="../qlx/img/favicon.ico">
    <!-- Tweaks for older IEs--><!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
    <script type="text/javascript" src="../qlx/vendor/jquery/jquery.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(function() {
            $("#login").click(function () {
                var username = $("#login-username").val();
                var password = $("#login-password").val();
                var code = $("#login-code").val();
                if (username.length == 0 || password.length == 0) {
                    alert("用户名和密码不能为空!");
                    return;
                }
                if (code.length == 0) {
                    alert("验证码填写不正确!")
                    return;
                }
                $.ajax({
                    url: '/studentsystem/checkLogin',
                    data: {username: username, password: password, code: code},
                    type: "post",
                    success: function (data) {
                        if (data == "") {
                            $("#checkCode").attr('src', '/studentsystem/checkCode?' + Math.random());
                            alert("用户名或者密码错误，请重试!");
                        } else {
                            $(location).prop('href', '/studentsystem/studentstarter');
                        }
                    }
                })
            })
        });
    </script>

  </head>
  <body>
    <div class="page login-page">
      <div class="container d-flex align-items-center">
        <div class="form-holder has-shadow">
          <div class="row">
            <!-- Logo & Information Panel-->
            <div class="col-lg-6">
              <div class="info d-flex align-items-center">
                <div class="content">
                  <div class="logo">
                    <h1>学生信息管理</h1>
                  </div>
                  <p>重庆交通大学信息学院计算机科学与技术.</p>
                </div>
              </div>
            </div>
            <!-- Form Panel    -->
            <div class="col-lg-6 bg-white">
              <div class="form d-flex align-items-center">
                <div class="content">
                  <form method="post" class="form-validate" action="">
                    <div class="form-group">
                      <input id="login-username" type="text" name="username" value="rujiawei"required data-msg="Please enter your username" class="input-material">
                      <label for="login-username" class="label-material">User Name</label>
                    </div>
                    <div class="form-group">
                      <input id="login-password" type="password" name="password" value="123456"required data-msg="Please enter your password" class="input-material">
                      <label for="login-password" class="label-material">Password</label>
                    </div>
                    <div style="float: left" class="form-group">
                      <div style="float: left" class="form-group">
                        <input id="login-code" type="text" name="code" required data-msg="Please enter your code" class="input-material">
                        <label for="login-code" class="label-material">Code</label>
                        <!-- <label class="sr-only" for="code">Code</label>
                        <input type="text" value="" name="code" placeholder="Code" class="col-md-6" id="code">-->
                      </div>
                      <div style="float: left" class="form-group">
                      <img id="checkCode"  style="height: 50px;width: 150px" src="/studentsystem/checkCode" onclick="this.src='/studentsystem/checkCode?'+ Math.random()">
                    </div>
                    </div>
                    <div style="clear: both"></div>
                    <a id="login"  class="btn btn-primary">登录</a>
                    <!-- This should be submit button but I replaced it with <a> for demo purposes-->
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="copyrights text-center">
        <p>Design by <a href="#" class="external">CQJTU.Company</a>
          <!-- Please do not remove the backlink to us unless you support further theme's development at https://bootstrapious.com/donate. It is part of the license conditions. Thank you for understanding :)-->
        </p>
      </div>
    </div>
    <!-- JavaScript files-->
    <script src="../qlx/vendor/jquery/jquery.min.js"></script>
    <script src="../qlx/vendor/popper.js/umd/popper.min.js"> </script>
    <script src="../qlx/vendor/bootstrap/js/bootstrap.min.js"></script>
    <script src="../qlx/vendor/jquery.cookie/jquery.cookie.js"> </script>
    <script src="../qlx/vendor/chart.js/Chart.min.js"></script>
    <script src="../assets/js/scripts.js"></script>
    <script src="../qlx/vendor/jquery-validation/jquery.validate.min.js"></script>
    <!-- Main File-->
    <script src="../qlx/js/front.js"></script>
  </body>
</html>